package com.bw.day03

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.base.net.mvvm.BaseViewActivity
import com.bw.day03.databinding.ActivityShopBinding

@Route(path = "/app/ShopActivity")
class ShopActivity : BaseViewActivity<ActivityShopBinding>() {
    @Autowired
    @JvmField
    var position=0
    override fun initView() {
        ARouter.getInstance().inject(this)
        //找到导航宿主
        val navHostFragment =
            supportFragmentManager.findFragmentById(R.id.fragmentContainerView) as NavHostFragment
        //导航器
        var navController = navHostFragment.navController
        binding.bottom.setupWithNavController(navController)
        when(position){
            0->{
                binding.bottom.selectedItemId = R.id.homeFragment
            }
            1->{
                binding.bottom.selectedItemId = R.id.categoryFragment
            }
            2->{
                binding.bottom.selectedItemId = R.id.carFragment
            }
            3->{
                binding.bottom.selectedItemId = R.id.mineFragment
            }
        }
    }

    override fun initData() {

    }

    override fun getLayoutId(): Int = R.layout.activity_shop

}